import { get, post } from '@/http/request'

export type LoginReq = {
	username: string
	password: string
}

// 刷新登录信息需要的参数
export type reLoginReq = {
	accessToken: string
}

// 登录后返回的响应信息
export type LoginResp = {
	username: string
	roles: Array<string>
	accessToken: string
}

export const userLogin = (data: LoginReq) => {
	return post<LoginResp>('/login', data)
}

export const refreshUserInfo = (data: reLoginReq) => {
	return post<LoginResp>('/getUserInfo', data)
}

export const getUserList = (data?: any) => {
	return get('/getUserList', data)
}
